const state = {
  enabledElements: {},
};

/**
 * Sets the enabled element `dom` reference for an active viewport.
 * @param {HTMLElement} dom Active viewport element.
 * @return void
 */
const setEnabledElement = (viewportIndex, imageViewportIndex, element) => {
  if (!state.enabledElements[viewportIndex]) {
    state.enabledElements[viewportIndex] = {};
  }
  state.enabledElements[viewportIndex][imageViewportIndex] = element;
};

/**
 * Grabs the enabled element `dom` reference of an active viewport.
 *
 * @return {HTMLElement} Active viewport element.
 */
const getEnabledElement = (viewportIndex, imageViewportIndex) => state.enabledElements[viewportIndex][imageViewportIndex];

export { setEnabledElement, getEnabledElement };
